wowwikifandomcom-20200223-history
OptionHouse
See also OptionHouse at . OptionHouse is a general master control panel, performance monitor, and centralized configuration mod for your addons. When installed as a separate addon, you can enable and disable addons, load addons that are LoadOnDemand, as well as get general addon metadata. You can use the included performance monitor to sort your addons by memory usage, memory increase per second, along with CPU usage if you have CPU profiling enabled. First and foremost, OptionHouse was designed to allow an easy centralized place to configure your addons. The library provides a way to categorize your options, and only creates those options screens which are access. In short, this addon will give you a nice place to configure any addons that use OH. There is currently a beta library called HousingAuthority available that handles creation of widgets that can then be displayed inside OptionHouse, you can also see example widgets for some code examples for making the configuration widgets. Access OptionHouse via the OptionHouse button in the Options screen that appears when you click the escape key. DongleObject OptionHouse API :RegisterAddon(nametitle, author, version) Registers a new addon. Args Returns Remarks Currently title, author, and version information is used on the addon management panel tooltips and on the tooltips for the addon in the centralized addon panel, if you use a different name from the addon's folder name then the extra information will not be loaded. Any registered information will override the toc values when displaying the tooltip in the addon management panel, however only the registered information is used on the centralized addon panel. If only one category exists and no sub categories, then it'll default to opening it when the addon is clicked on the configuration tab. An example of registering a category and a sub category. local OptionHouse = DongleStub("OptionHouse-1.0") local OHObject = OptionHouse:RegisterAddOn( "FooBar", "FooBar 1.0.0", "YourName", "1.0.0" ) OHObject:RegisterCategory( "Test", FooBar, "ShowTest" ) OHObject:RegisterSubCategory( "Test", "Sub Cat", FooBar, "ShowSubCat" ) OptionHouse Object API OHObject:GetFrame(type) Args Returns Remarks This was added in r553. If you were referencing an OptionHouse frame directly by name you will need to update and use :GetFrame(type) instead. The "main" type is for the main OptionHouse frame, this is the one that everything else is parented to, "addon" is for all of the configurations that addons register, "manage" is for the addon control panel, "perf" is for the performance panel. OHObject:RegisterCategory(name, handlerfunc, noCache, sortID) Args Remarks If we want to register the handler Foo and the function Bar with OptionHouse you'd need to do RegisterCategory( "Category", Foo, "Bar" ), if you want to just register the function Foo then you'd do RegisterCategory( "Category", Foo ) The function registered must return a frame, unless you specify noCache the frame will be saved and called instead of the function the next time the category is clicked. If you want to detect when the frame is used you must register OnShow with that frame and populate it yourself. When noCache is passed the function will be called every time and the frame will not be cached, useful if you want to use one frame for multiple options. Frames cannot have a width higher then 630 and a height over 305, if either width or height exceeds those numbers they'll be forced back to 630 and 305, if no width or height is specified then it'll default to 630/305. If no position is set then the frame will be positioned to TOPLEFT, , "TOPLEFT", 190, -103, all frames will be parented to the OptionHouse configuration frame. This applies to all frames and not just cached ones. The function/handler will be called as: handler.func( handler, catsub cat) or func( catsub cat) OHObject:RemoveCategory(name) Removes a register category. Because the entry is removed from OptionHouse, the frame cache for the category will be cleared and it'll call the registered handler and/or function the next time the category is clicked. Args Remarks No errors are generated if the category is nil or doesn't exist. OHObject:RegisterSubCategory(parentCat, name, handlerfunc, noCache, sortID) Args Remarks This functions the same way as OHObject:RegisterCategory() does for frame rules and arguments, parentCat has to be the same as the name you registered in OHObject:RegisterCategory(), and will be shown as a sub category of parentCat. OHObject:RemoveSubCategory(parentCat, name) Removes a subcategory from a category, like OHOBject:RemoveCategory() the same issue regarding functions being called after the frame is created applies. Args Remarks No errors are generated if the category is nil or doesn't exist. Category:Dongle